<%@ page import="com.ama.utils.SpringUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="com.ama.dao.ApplyDao" %>
<%@ page import="com.ama.dao.CostDao" %>
<%@ page import="com.ama.service.impl.*" %>
<%@ page import="com.ama.service.*" %>
<%@ page import="com.ama.pojo.*" %>
<%@ page import="com.ama.utils.NumberUtils" %>
<%@ page import="com.baomidou.mybatisplus.core.conditions.query.QueryWrapper" %>
<%@ page import="com.ama.utils.DateUtil" %>
<%@ page import="com.ama.dao.RepairDao" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>报修通知</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="yinqi">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/materialdesignicons.min.css" rel="stylesheet">
    <link href="../css/style.min.css" rel="stylesheet">
</head>
    <%
        RepairDao repairDao = SpringUtils.getBean(RepairDao.class);
        QueryWrapper queryWrapper = new QueryWrapper();
        Property property = (Property) session.getAttribute("user");
        queryWrapper.eq("property_id",property.getPropertyId());
        queryWrapper.eq("repair_state",0);
        List<Repair> repairList = repairDao.selectList(queryWrapper);
    %>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <form action="s_build.jsp" method="post" class="guide-box" data-navigateable="true">
                        <!-- 对应内容 -->
                        <div class="nav-step-content">
                            <div class="fixed-table-container" style="padding-bottom: 0px;">
                                <div class="fixed-table-header" style="display: none;">
                                    <table></table>
                                </div>
                                <div class="fixed-table-body">
                                    <div class="fixed-table-loading table table-bordered table-hover table-striped"
                                         style="top: 44px; display: none;">
                                        <span class="loading-wrap">
                                            <span>class="loading-text">正在努力地加载数据中，请稍候</span>
                                            <span class="animation-wrap"><span class="animation-dot"></span></span>
                                        </span>
                                    </div>
                                    <table id="tb_departments" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th style="" data-field="id">
                                                <div class="th-inner sortable both">ID</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="nationality">
                                                <div class="th-inner ">报修住址</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="author">
                                                <div class="th-inner ">报修时间</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="author">
                                                <div class="th-inner ">报修类型</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="author">
                                                <div class="th-inner ">联系方式</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="id">
                                                <div class="th-inner sortable both">维修状态</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="" data-field="operate">
                                                <div class="th-inner ">操作</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                        </tr>
                                        </thead>

                                        <tbody>
                                        <%
                                            int status = 1;
                                            for (Repair repair : repairList) {

                                        %>
                                        <tr>
                                            <td><%=status%>
                                            </td>
                                            <td><%=repair.getRepairAddress()%>
                                            </td>
                                            <td><%=DateUtil.dateToStr(repair.getRepairDate())%>
                                            </td>
                                            <td><%=repair.getRepairType()%>
                                            </td>
                                            <td><%=repair.getPhoneNumber()%>
                                            </td>
                                            <%
                                                if (repair.getRepairState() == 1) {
                                            %>
                                            <td style="">
                                                <a href="javascript:void(0)" data-name="status" data-pk="1"
                                                   class="label label-success editable editable-click"
                                                   data-value="1">已维修
                                                </a>
                                            </td>
                                            <%
                                            } else if (repair.getRepairState() == 0) {
                                            %>
                                            <td style="">
                                                <a href="javascript:void(0)" data-name="status" data-pk="1"
                                                   class="label label-danger editable editable-click"
                                                   data-value="1">等待维修
                                                </a>
                                            </td>
                                            <%
                                            }
                                            %>


                                            <td>
                                                <a type="button"
                                                   href="p_repairDetail.jsp?repairId=<%=repair.getRepairId()%>"
                                                   class="btn btn-default">
                                                    查看详情
                                                </a>
                                            </td>

                                            <%
                                                status++;}
                                            %>

                                        </tr>
                                        </tbody>


                                    </table>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>